<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <title>战队详情</title>
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/base.css?v=14" />
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/mod.css?v=14" />
    <link rel="stylesheet" type="text/css" media="screen" href="{$staticHost}/static/css/run.css?v=130" />
    <script src="{$staticHost}/static/js/iscroll.js"></script>
    <script src="{$staticHost}/static/js/jquery.min.js"></script>
    <script src="{$staticHost}/static/js/js.js"></script>
    </head>


<body>
  <div id="wrapper">
      <div id="scroller">
        <section class="club_base club-sign"></section>
        <nav class="gray-nav">
          <a id="cs-home" class="on">主页</a>
          <a id="cs-member" >成员</a>
          <a id="cs-data">资料</a>
        </nav>
        <!-- 导航按钮 -->
        <section id="cs-home-box" class="cs-home"></section>
        <!-- 主页 -->
        <div class="club_members cs-member"  style="display:none;"></div>
        <!-- 成员 -->
        <dl class="club_info club-data cs-data-sign pb50" style="display:none;"></dl>
        <!-- 资料 -->
    </div>
  </div>
  <div class="masklayer set_header" style="display: none;" >
     <span class="set-bounced">
        <a href="javascript:;" id="club_dissolve">解散</a>
        <a href="javascript:;" id="club_remove">移除成员</a>
      </span>
  </div>
  <div class="masklayer set_out" style="display: none;" >
     <span class="set-bounced">
        <a href="javascript:;" id="club_out">退出</a>
      </span>
  </div>
 
</body>
<script id="club_base_tpl" type="text/html">
    <img src="<%=image%>"/>
    <p>
      <%=title%><br/>
      <span class="color-blue">
      <%=clubPmStatusMsg%>
      </span>
    </p>
    <% if(userStatus * 1 == 2) { %>
      <a href="javascript:;" class="<% if(isLeader * 1 == 1) { %>set_header_show<% } else { %>set_members_show<% } %>">设置</a>
    <% } else if(userStatus * 1 == 1) { %>
    <a class="bg_blue" href="javascript:;" style="color:#fff">待审核</a>
    <% } else { %>
    <a href="javascript:;" class="join_club" data-cid="<%=id%>">加入</a>
    <% } %>
</script>
<!-- 俱乐部详情title -->
<script id="club_info_tpl" type="text/html">
    <dt class="p10">
      战队成立时间
      <span><%=formatTime%></span>
    </dt>
    <dt class="p10">
      所属城市
      <span><%=proviceName%> <%=cityName%></span>
    </dt>
    <%if(haveTicket == true){%>
      <dd class="straight">
        季末总里程冠军争霸赛直通卡
        <p>
          竞赛日期 
          <i id="starZt"></i>
          - 
          <i id="endZt"></i>
        </p>
        <span><%=title%></span>
      </dd>
    <%}%>
    <%if(haveCertificate == true&&userStatus==2){%>
      <dd class="certificate" >战队证书</dd>
    <%}%>
    <dt id="notice" class="p10">
      战队招募公告
      <p class="color_gray mt10">
        <%=content%>
      </p>
    </dt>

    <dt class="p10">赛季纪录</dt>
    <% if(gameLog.length==0) { %>
    <dd class="line-gray-bottom"><img class="none" src="/static/images/img/club-bg.png"></dd>
    <%}%>

    <% if(gameLog.length>0) { %>
    <% for(var i = 0; i < gameLog.length; i++) { %>
    <dd class="pl10 lh23 pr">
      <h5 class="f14 line-gray lh32"><%=gameLog[i].headMsg%></h5>
      <% for(var q = 0; q < gameLog[i].list.length; q++) { %>
      <p class="f14 color_gray mt5 line-gray pb15">
        <span class="f14 color_dakgray db pt10 pb5">
        <%if(gameLog[i].list[q].type==4){%>
          战队总积分
          <%if(gameLog[i].list[q].rankValue){%>
            <%=gameLog[i].list[q].rankValue%>
          <%}else{%>
            --
          <%}%> 　

          排名
          <%if(gameLog[i].list[q].rank){%>
            <%=gameLog[i].list[q].rank%>
          <%}else{%>
            --
          <%}%> 
        <%}else{%>
          总跑量
          <%if(gameLog[i].list[q].rankValue){%>
            <%=gameLog[i].list[q].rankValue%>km
          <%}%>
          <%if(!gameLog[i].list[q].rankValue){%>--<%}%> 　

          排名
          <%if(gameLog[i].list[q].rank){%>
            <%=gameLog[i].list[q].rank%>
          <%}%>
          <%if(!gameLog[i].list[q].rank){%>--<%}%> 　 　 　
        <%}%>
        </span>
        <%if(gameLog[i].list[q].type==4){%>
        累计跑量积分 <%=gameLog[i].list[q].mileageScore %>
        <br/>
        累计配速积分 <%=gameLog[i].list[q].speedScore %>
        <br/>
        累计人气积分 <%=gameLog[i].list[q].supportScore %>
        <%}%>
      </p>
        <%if(gameLog[i].list[q].haveCup==1){%>
          <i class="trophy"></i>
        <%}%>
      <%}%>
    </dd>
    <%}%>
    <%}%>
    <!-- <dd class="pl10 pt10 lh23 pr">
      <h5 class="f14 line-gray line-tgray lh32">第一轮最好成绩</h5>
      <h6 class="f16 pt10">预选赛</h6>
      <p class="f14 color_gray mt5">总跑量22.00km 排名10/300</p>
      <i class="trophy"></i>
    </dd> -->
    <!-- <dd class="line-gray"> <a href="paomeHOme" class="arrows blue-line color-blue">点击这里去跑么杯首页看看</a></dd> -->
</script>
<!-- 俱乐部详情  资料部分 -->
<script id="club_members_tpl" type="text/html">
  <dl class="club-data">
    <dt class="p10">
      战队成员
      <span>人数 <% if(memberList.list.length < 10) { %>0<% } %><%=memberList.list.length%>/30 人</span>
    </dt>
    <dd>
      <div class="colonel" >
        <span>队长</span>
         {if $uid}
          <%if(memberList.list[0].uid!={$uid}){%>
             <a id="check-no">查看介绍</a>
          <%}%>
           <%if(memberList.list[0].uid=={$uid}){%>
            <a href="meIntro?clubId={$clubId}&content=<%=memberList.list[0].leaderIntroduce%>" id="check">我的简介</a>
          <%}%>
        
        {else}
          <a id="check-no">查看介绍</a>
        {/if}
        
      </div>
      
      <ul class="data-show member" style="border:none;">
        <% for(var i = 0; i < memberList.list.length; i++) { %>
        <li class="user" data-id="<%=memberList.list[i].uid%>">
          <img src="<%if(memberList.list[i].header){%><%=memberList.list[i].header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
          <p class="omit"><%=memberList.list[i].nickname%></p>
          <span class="km color_dakgray bold">
            <small class="color_gray">本轮里程</small>
            <%if(memberList.list[i].mileage==0){%>-<%}%>
            <%if(memberList.list[i].mileage!=0){%>
              <%=memberList.list[i].mileage%>km
            <%}%>      
          </span>
        </li>
        <% } %>
      </ul>
    <!-- 运动员数据排行 -->
    </dd>
  </dl>
  <%if(haveTicket=flase){%>
  <section class="spokesperson" >
    <h3 class="blue-line">明星成员</h3>
    <ul>
      <li class="user" data-id="<%=star.leader.uid%>">
        <img src="<%if(star.leader){%><%=star.leader.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>">
        队长
      </li>
     
      <li class="user" data-id="<%=star.mile.uid%>">
        <img src="<%if(star.mile.header){%><%=star.mile.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>">
        贡献跑量最多
      </li>
      <li class="user" data-id="<%=star.onceMile.uid%>">
        <img src="<%if(star.onceMile.header){%><%=star.onceMile.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>">
        单次最远距离
      </li>
     
      <li class="user" data-id="<%=star.support.uid%>">
        <img src="<%if(star.support.header){%><%=star.support.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>">
        人气最高
      </li>
     
      <li class="user" data-id="<%=star.speed.uid%>">
        <img src="<%if(star.speed.header){%><%=star.speed.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>">
        配速最快
      </li>
      
    </ul>
  </section>
  <!-- 跑么杯明星代言人 -->
  <%}%>
</script>
<!-- 俱乐部详情  成员 -->
<script id="cs-home-mo" type="text/html">
  <div class="recruit line-gray-bottom">
    <img src="/static/images/icon/icon6.png"/>
    <p><%=result.content%></p>
    <a href="noticeList?clubId={$clubId}">更多</a>
  </div>
  <!-- 公告 -->
  <dl class="club-data mt10 " style="display: ;">
    <dt><%=result.homeData.clubData.gameTitle.title%></dt>
    <dd class="data-all">
      <%for(var i=0; i<result.homeData.clubData.gameData.length;i++){%>
      <span>
        <%if(result.homeData.clubData.gameData[i].type==1){%>今日战队跑量<%}%>
        <%if(result.homeData.clubData.gameData[i].type==2){%>今日战队配速<%}%>
        <%if(result.homeData.clubData.gameData[i].type==3){%>累计人气<%}%>
        <b>
          <%if(result.homeData.clubData.gameData[i].rankValue * 1<=0){%>--
          <% } else { %>
            <%if(result.homeData.clubData.gameData[i].rankValue * 1==1){%>
              <%=result.homeData.clubData.gameData[i].rankValue%>km
            <%} else {%>
            <%=result.homeData.clubData.gameData[i].rankValue%>
            <%}%>
          <%}%>
        </b>
        排名
        <%if(result.homeData.clubData.gameData[i].rank<=0){%>--<%}%>
        <%if(result.homeData.clubData.gameData[i].rank>0){%>
          <%=result.homeData.clubData.gameData[i].rank%>
        <%}%> 
        积分
        <%if(result.homeData.clubData.gameData[i].score<=0){%>--<%}else{%>
        <%=result.homeData.clubData.gameData[i].score%>
        <%}%>
      </span>
      <%}%>
    </dd>
    <!-- 本轮竞赛数据 -->
    <dt class="p10">
      本赛季运动员数据
      <!-- <span>运动人数<%=result.homeData.runData.gameNum%>人</span> -->
    </dt>
    {if $uid}
    <%if(result.homeData.isClubUser==1){%>
    <div class="round-tab">
      <a id="all-zlc" class="rank_tab on">今日跑量</a>
      <a id="all-pace" class="rank_tab">今日配速</a>
      <a id="all-moods" class="rank_tab">累计人气</a>
    </div>
    <%}%>
    {/if}
    <dd class="qh">
      <section class="all all-zlc" style="border: none;">
        <p class="plr10 pb15 f14">
          <!-- 第<span id="wheel"></span>轮参与人数 -->
          今日跑步人数
          <span class="fr">
            <%=result.homeData.runData[0].gameNum%>/
            <%=result.homeData.totalUser%>
            人
          </span>
        </p>
        <ul class="addup pr data-show">
          <%for(var q=0; q < result.homeData.runData["0"].list.length;q++){%>
          <li>
            <span class="days"><b><%=result.homeData.runData[0].list[q].rank%></b></span>
            <img class="user" data-id="<%=result.homeData.runData[0].list[q].uid%>" src="<%if(result.homeData.runData[0].list[q].header){%><%=result.homeData.runData[0].list[q].header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>

            <p class="omit"><%=result.homeData.runData[0].list[q].nickname%></p>
            <span class="km color_dakgray bold"><%=result.homeData.runData[0].list[q].rankValue%></span>
          </li>
          <%}%>
        </ul>
      </section>
      <!-- 运动员数据排行 跑量 -->
      <ul class="all data-show all-pace dn" style="border: none; margin-top: -10px;padding-top: 0;">
        <li class="p10 f14">
          成员中至少5人单次≥3km才计入配速榜
        </li>
        <%for(var q=0; q<result.homeData.runData[1].list.length;q++){%>
        <li>
          <span class="days"><b><%=result.homeData.runData[1].list[q]["rank"]%></b></span>
        
          <img class="user" data-id="<%=result.homeData.runData[1].list[q].uid%>" src="<%if(result.homeData.runData[1].list[q].header){%><%=result.homeData.runData[1].list[q].header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>

          <p class="omit"><%=result.homeData.runData[1].list[q].nickname%></p>
          <span class="km color_dakgray bold">
          <%if(result.homeData.runData[1].list[q].rankValue=="00'00''"){%>
            --
          <%}else{%>
            <%=result.homeData.runData[1].list[q].rankValue %>
          <%}%>  
          </span>
        </li>
        <%}%>
      </ul>
      <!-- 运动员数据排行 配速-->
      <section class="all all-moods " style="border: none; display: none;">
        <p class="plr10 f14">
          成员累计人气（赞+打赏人气）<br/>
        </p>
        <ul class="data-show addrq mt15" >
          <%for(var q=0; q<result.homeData.runData[2].list.length;q++){%>
          <li>
            <span class="days"><b><%=result.homeData.runData[2].list[q]["rank"]%></b></span>
             <img class="user" data-id="<%=result.homeData.runData[2].list[q].uid%>" src="<%if(result.homeData.runData[2].list[q].header){%><%=result.homeData.runData[2].list[q].header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>

            <p class="omit"><%=result.homeData.runData[2].list[q].nickname%></p>
            <span class="km color_dakgray bold">
              <%if(result.homeData.runData[2].list[q].rankValue==0){%>--<%}%>  
              <%if(result.homeData.runData[2].list[q].rankValue!=0){%>
               <%=result.homeData.runData[2].list[q].rankValue %>
              <%}%>  
            </span>
          </li>
        <%}%>
      </ul>
      <!-- 运动员数据排行 人气-->
    </section>
      
    </dd>
  </dl>
 
</script>
<!-- 俱乐部详情模板  主页 -->
<section id="cs" class="masklayer" style="display: ;">
 <div class="pao-tier" style="top: 20%;width: 90%;left:5%;">
    <span class="pao-close"></span>
    <div class="tier-colonel">
      <img id="img-box" src="">
      <span class="dib vm">队长：<i id="tz-box"></i></span>
      <p id="in-box" class="p10 f14 line-tgray mt10"></p>
     </div>
  </div>
</section>
<section id="mask-box" class="masklayer" style="display: ;"></section>
<script id="mask" type="text/html">
  <div class="pao-tier" style="top: 20%;width: 90%; left: 5%">
    <span class="pao-close"></span>
    <div class="user-datum">
      <img src="<%if(result.member.header){%><%=result.member.header%><%}else{%>/static/images/bg/group_image_nor-min.png<%}%>"/>
      <h4>助<%=result.member.nickname%>问鼎人气榜冠军</h4>
      <p class="imaginary">所属战队：<%=result.clubInfo.title%></p>
      <section class="no-znl">
         <ul class="user-datum-list">
          <li class="right-line">
            全员跑量
            <b>
              <%if(result.userData.mileag==0.00){%>--<%}%>
              <%if(result.userData.mileage>0){%>
                <%=result.userData.mileage%>km 
              <%}%>
            </b>
          </li>
          <li>
            全员跑量排名
            <b>
              <%=result.userData.rankInfo%>
            </b>
          </li>
        </ul>
        <ul class="user-datum-list imaginary">
          <li class="right-line">
            最远纪录
            <b>
              <%if(result.userData.max_mileage==0.00){%>--<%}%>
              <%if(result.userData.max_mileage>0){%>
                <%=result.userData.max_mileage%>km
              <%}%>
            </b>
          </li>
          <li class="right-line">
            获得点赞数
            <b>
              <%if(result.userData.agree_num==0){%>--<%}%>
              <%if(result.userData.agree_num>0){%>
                <%=result.userData.agree_num%>
              <%}%>
            </b>
          </li>
          <li>
            获得打赏人气
            <b>
              <%if(result.userData.energy_num==0){%>--<%}%>
              <%if(result.userData.energy_num>0){%>
               <%=result.userData.energy_num%>
              <%}%>
            </b>
          </li>
        </ul>
        <p>喜欢Ta就支持Ta，让Ta榜上有名</p>
        <div class="user-btn">
          <a id="like">为Ta点赞</a>
          <a class="ta" class="<%if(result.isLight==1){%>on<%}%>" >打赏人气</a>
        </div>
      </section>
      <section id="znl" style="display: none;">
       <!--  <h4>赋予正能量</h4>
        <p>喜欢Ta就支持Ta，让Ta榜上有名</p> -->
        <ul class="energy-list">
          <li>10</li>
          <li>15</li>
          <li class="on">20</li>
          <li>25</li>
          <li>30</li>
        </ul>
        <p>您的正能量当前剩余：<%=result.total_energy%></p>
        <div class="user-btn">
          <a class="gl" class="on" style="width:95%">鼓 励 一 下</a>
        </div>
      </section>
    </div>
  </div>
</script>
  <div id="tips"></div>
<script type="text/javascript">
  var uid = "{$uid}";
  var sup = typeof jw == "object";
  var isClickJoin = false;
  var screenHeight = "";
  var myScroll;
  function loaded () {
    myScroll = new IScroll('#wrapper', { bounceEasing: 'elastic', bounceTime: 100 });
  }
  $("#cs-home").click(function(){
    $(".cs-member,.cs-data-sign").hide();
    $(".cs-home").show();
    $(".gray-nav a").removeClass("on");
    $("#cs-home").addClass("on");
  })
  $("#cs-member").click(function(){
    $(".cs-data-sign,.cs-home").hide();
    $(".cs-member").show();
    $(".gray-nav a").removeClass("on");
    $("#cs-member").addClass("on");
  })
  $("#cs-data").click(function(){
    $(".cs-member,.cs-home").hide();
    $(".cs-data-sign").show();
    $(".gray-nav a").removeClass("on");
    $("#cs-data").addClass("on");
  })

{if $clubId}
  $(function(){
      $.get('{$appHost}/paome_webIndex/getClubDetailApi?clubId={$clubId}', function(data){
          data = JSON.parse(data);
          if(data.result.homeData != undefined && data.result.homeData) {
            
              var html = template('club_base_tpl', data.result.doc);
              $('.club_base').html(html);

              var html = template('club_info_tpl', data.result.doc);
              $('.club_info').html(html);

              if(data.result.doc.userNum <= 1) {
                  $('#club_remove').remove();
              }
          }
          var userNum =data.result.doc.userNum;
          console.log(userNum)
            if(userNum==30){
              $(".join_club").hide();
            }
            for (x in data.result.homeData.runData[0].list) {
              if(data.result.homeData.runData[0].list[x].rankValue!=null){
                data.result.homeData.runData[0].list[x].rankValue=Number(data.result.homeData.runData[0].list[x].rankValue).toFixed(2)+"km"
              }else{
                data.result.homeData.runData[0].list[x].rankValue="--"
              }
              if(data.result.homeData.runData[0].list[x].rank==0){
                data.result.homeData.runData[0].list[x].rank="-"
              }
            }
            for (x in data.result.homeData.runData[1].list) {
             
              if(data.result.homeData.runData[1].list[x].rank==0){
                data.result.homeData.runData[1].list[x].rank="-"
              }
            }
            for (x in data.result.homeData.runData[2].list) {
         
              if(data.result.homeData.runData[2].list[x].rank==0){
                data.result.homeData.runData[2].list[x].rank="-"
              }
            }
          var html = template('cs-home-mo', data);
          document.getElementById('cs-home-box').innerHTML = html;
          $(".certificate").click(function(){
            window.location.href = '/paome_webIndex/paoZs?clubId=' + '{$clubId}';
          })
          $("#wheel").html(data.result.doc.gameLog.headMsg)

          $(".cs-home").html(html);
          if(data.result.member.memberList.list!= undefined && data.result.member.memberList.list) {
              var html = template('club_members_tpl', data.result.member);
              $('.club_members').html(html);
              $("#check-no").click(function(){
                $("#cs").show();
                $("#img-box").attr("src",data.result.member.memberList.list[0].header)
                $("#tz-box").html(data.result.member.memberList.list[0].nickname)
                if(data.result.member.memberList.list[0].leaderIntroduce.length>0){
                  $("#in-box").html(data.result.member.memberList.list[0].leaderIntroduce)
                }else{
                  $("#in-box").html("优质战队，队长带队经验丰富")
                }
            })
            data.starZt = data.result.doc.zbsTime.startTime;
            data.endZt = data.result.doc.zbsTime.endTime;
            var d = new Date(parseInt(data.starZt) * 1000);
            data.starZt =xs(d.getMonth()+1)+"月"+xs(d.getDate())+ "日";
            var q = new Date(parseInt(data.endZt) * 1000);
            data.endZt =xs(q.getMonth()+1)+"月"+xs(q.getDate())+ "日";
            function xs(n){ return n<10?("0"+n):n;}
            $("#starZt").html(data.starZt);
            $("#endZt").html(data.endZt);
            // 直通车日期

             $(".user").click(function(){
              var uidD = "{$uid}";
              if(!uidD){
                $("#tips").show();
                $("#tips").html("亲，登陆后才能操作哦")
                Timeout();
                return;
              }
              var target_uid = $(this).attr('data-id')
              var uid =target_uid;
               $.get("{$staticHost}/paome_hall/getUserPaome", {'target_uid':target_uid}, function(data, error) {
                var data=JSON.parse(data);
                var userName = data.result.member.nickname;
              $(".masklayer").hide();
                  if(data.result == undefined || data.result.userData == undefined || !data.result.userData){
                    $(".masklayer").hide();
                    return;
                  }
                  var html = template('mask', data);
                  document.getElementById('mask-box').innerHTML = html;
                  var uidD = "{$uid}";
                  if(uidD.length>0){
                  if(uid==uidD){
                    $(".user-btn").hide();
                  }
                  }
                  $(".pao-close").click(function(){
                    $(".masklayer").hide();
                  })
                  $("#like").click(function(){
                     $.get("{$staticHost}/paome_hall/paomeThumbUp", {'target_uid':uid}, function(data) {
                      data=JSON.parse(data);
                      if(data.error != undefined) {
                        $("#tips").show();
                        $("#tips").html(data.error.text);
                        Timeout()
                      } else {
                        var light = data.result.light * 1;
                        if(light > 0){
                          $("#like").html("已点赞喽");
                          $("#like").unbind();
                          $("#tips").show();
                          $("#tips").html("已打赏"+light+"赞");
                          Timeout()
                        }
                      }
                     })
                  })
                  if(data.result.isLight==1){
                    $(".ta").addClass('on');
                    $("#like").html("已点赞喽")
                    $("#like").unbind();
                  }
                  if(data.result.isSupport==1){
                    $(".ta").html("已打赏喽")
                    $(".ta").unbind();
                  }else{
                      $(".ta").click(function(){
                      $(".no-znl").hide();
                      $("#znl").show();
                    })
                  }
                 
                  
                  $(".energy-list li").click(function(){
                      $(".energy-list li").removeClass('on')
                      $(this).addClass('on');
                  })
                  
                  $(".gl").click(function(){
                    var energyNum = $(".energy-list .on").text();
                    var energyNum = energyNum*1
                    var energy = (data.result.total_energy)*1
                    if(energyNum>energy){
                      $(".gl").unbind();
                      $("#tips").show();
                      $("#tips").html("亲，您的当前正能量不足，快去赚取吧")
                      Timeout();
                      
                      return
                    }
                    $.get("{$staticHost}/paome_hall/reward", {'target_uid':uid,'energy':energyNum}, function(data,error) {
                      data=JSON.parse(data);
                        if(typeof data.result != 'undefined' && typeof data.result.isInsert!= 'undefined' &&data.result.isInsert!=0){
                          $(".gl").html("已打赏咯")
                          $("#tips").show();
                          $("#tips").html("土豪，您已经为 "+userName+" 打赏 "+energyNum+" 个人气");
                           Timeout()
                          $("#mask-box").hide();
                        }else{
                          $("#tips").show();
                          $("#tips").html(data.error.text);
                          Timeout()
                        }
                    })
                  })
                // 获取信息
                $("#mask-box").show();
             })
           })
        }
        
        $(".pao-close").click(function(){
          $(".masklayer").hide();
        })

         $('.rank_tab').click(function(){
          if($(this).hasClass('on')) {
            return;
          }
          var tab_class = $(this).attr('id');
          $('.rank_tab').each(function(){
            if($(this).attr('id') == tab_class) {
              $(this).addClass('on');
            } else {
              $(this).removeClass('on');
            }
          });
          $('.qh .all').each(function(){
            if($(this).hasClass(tab_class)) {
              $(this).show();
             screenHeight = document.body.scrollHeight
            } else {
              $(this).hide();
            }
          });
        });

       
      if( data.result.homeData.isClubUser!=1){
         $(".recruit").hide();
      }
      $.get('{$appHost}/paome_center/clubAffiche?clubId={$clubId}', function(data){
        data = JSON.parse(data);
        var content = data.result.content;
        $(".recruit p").html(content)
      })
      
        // 获取公告
    });

    $('.join_club').live('click', function(){
        nologin();
        if(isClickJoin) {
          return;
        }
        isClickJoin = true;
        var club_id = $(this).attr('data-cid') * 1;
        var o = this;
        if(club_id) {
            $.post('{$appHost}/paome_webIndex/joinClub', {'clubId': club_id}, function(res){
                var res = JSON.parse(res);
                if(res.error != undefined) {
                    alert(res.error.text);
                } else if(res.result != undefined) {
                    if(res.result.is_success * 1 == 1) {
                        $(o).addClass('bg_blue').attr({'style': 'color:#fff'}).text('待审核');
                    }
                }
                isClickJoin = false;
            });
        }
    });

    $('.set_header_show').live('click', function(event){
        $('.set_header').show();
    });

    $('.set_members_show').live('click', function(event){
        $('.set_out').show();
    });

    $('.set_out,.set_header').on('click', function(event){
        $(this).hide();
    })

    $('#club_out').live('click', function(event){
      var sure = confirm('没有战队的参赛者的成绩不会被统计哦！\n确定退出战队么？');
      if(sure) {
        $.post('{$appHost}/paome_webIndex/outClub', {}, function(data){
            data = JSON.parse(data);
            if(data.error != undefined) {
                alert(data.error.text);
            } else {
                alert('退出成功！');
                window.history.go(-1);
            }
        })
      }
      event.stopPropagation();
    })

    $('#club_dissolve').live('click', function(event){
      var sure = confirm('战队解散后不再参与跑么杯竞赛\n您及成员也将无法查看战队成绩及信息');
      if(sure) {
        $.post('{$appHost}/paome_webIndex/killClub', {}, function(data){
            data = JSON.parse(data);
            if(data.error != undefined) {
                alert(data.error.text);
            } else {
                alert('解散成功！');
                window.location.href = '/paome_webIndex/paomeHome';
            }
        })
      } else {
        $('.masklayer').click();
      }
      event.stopPropagation();
    })

    $('#club_remove').live('click', function(event){
        window.location.href = '/paome_webIndex/removeMember?clubId=' + '{$clubId}';
        event.stopPropagation();
    })
  });
  {/if}

  function nologin() {
      if(!uid){
          if(!sup){
              window.location.href="http://mobile.hupu.com/download/joggers?r=share"
          }else{
              window.location.href="joggers://login";
          }
          return;
      }
  }
  function Timeout(){
    // screenHeight = document.body.scrollHeight
    // var ee=screenHeight/2;
    $("body").css("overflow","hidden")
    // $("#tips").css("top",ee+"px")
    setTimeout(function(){ 
     $("#tips").hide();
     $("body").css("overflow","auto")
    }, 2000);
  }
</script>

{template 'show/web-footer'}